/*
 * @Author: zhengzhuang
 * @Date: 2020-05-16 15:28:15
 * @LastEditors: zhengzhuang
 * @LastEditTime: 2020-08-04 17:44:05
 * @Description: 二维码收款
 * @FilePath: /C20Driver_1.0.0/lib/pages/general_module/qr_code_collection.dart
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:C20Driver/provider/order_information.dart';
import 'package:C20Driver/routers/navigator_util.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';

class QrCodeCollection extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    OrderInformation dataInfo = Provider.of<OrderInformation>(context);
    return WillPopScope(
      child: Scaffold(
        appBar: AppBar(
          title: Text('二维码收款'),
        ),
        body: Container(
          child: Center(
            child: Column(
              children: <Widget>[
                SizedBox(height: ScreenUtil().setSp(130.0)),
                Text('扫二维码向我付款',
                    style: TextStyle(
                        fontSize: ScreenUtil().setSp(32.0),
                        color: Color.fromARGB(255, 138, 138, 138))),
                SizedBox(height: ScreenUtil().setSp(40.0)),
                RichText(
                  text: TextSpan(
                      text: '¥',
                      style: TextStyle(
                          fontSize: ScreenUtil().setSp(50.0),
                          color: Colors.black,
                          fontWeight: FontWeight.w400),
                      children: <TextSpan>[
                        TextSpan(
                            text: '${dataInfo.amountCollected}',
                            style: TextStyle(
                                fontSize: ScreenUtil().setSp(70.0),
                                color: Colors.black,
                                fontWeight: FontWeight.w400))
                      ]),
                ),
                SizedBox(height: ScreenUtil().setHeight(50.0)),
                Container(
                    width: ScreenUtil().setWidth(400.0),
                    height: ScreenUtil().setWidth(400.0),
                    child: QrImage(
                      data: '${dataInfo.codeUrl}',
                      version: QrVersions.auto,
                      // size: ScreenUtil().setSp(30.0),
                      gapless: false,
                    ))
              ],
            ),
          ),
        ),
      ),
      onWillPop: () {
        // Navigator.of(context).popUntil((route) => route.isFirst);
        NavigatorUtil.goBack(context);
      },
    );
  }
}
